home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nivb / prntserv.frm < prev    next >
Text File  |  1995-05-07  |  3KB  |  92 lines

  1. VERSION 2.00
  2. Begin Form PrintServerForm 
  3.    Caption         =   "Print Server Services Test"
  4.    ClientHeight    =   2715
  5.    ClientLeft      =   1455
  6.    ClientTop       =   1545
  7.    ClientWidth     =   5265
  8.    Height          =   3120
  9.    Left            =   1395
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   2715
  12.    ScaleWidth      =   5265
  13.    Top             =   1200
  14.    Width           =   5385
  15.    Begin CommandButton CancelButton 
  16.       Caption         =   "&Cancel"
  17.       Height          =   375
  18.       Left            =   2880
  19.       TabIndex        =   2
  20.       Top             =   2160
  21.       Width           =   855
  22.    End
  23.    Begin CommandButton OKButton 
  24.       Caption         =   "&OK"
  25.       Default         =   -1  'True
  26.       Height          =   375
  27.       Left            =   1680
  28.       TabIndex        =   1
  29.       Top             =   2160
  30.       Width           =   855
  31.    End
  32.    Begin ListBox PrintServerList 
  33.       Height          =   1590
  34.       Left            =   720
  35.       TabIndex        =   0
  36.       Top             =   480
  37.       Width           =   4215
  38.    End
  39.    Begin Label Label1 
  40.       Caption         =   "Select a print server:"
  41.       Height          =   255
  42.       Left            =   240
  43.       TabIndex        =   3
  44.       Top             =   120
  45.       Width           =   2175
  46.    End
  47. End
  48. Const CR = 13
  49.  
  50. Sub CancelButton_Click ()
  51.     Unload PrintServerForm
  52. End Sub
  53.  
  54. Sub Form_Load ()
  55.     Dim objectType As String * 6
  56.  
  57.     PrintServerList.Clear
  58.  
  59.     oID& = -1   'initialize object ID to -1 for first call to ScanBinderyObject
  60.     Do
  61.         oName$ = String$(48, 0)
  62.         ccode% = ScanBinderyObject("*", OT_PRINT_SERVER, oID&, oName$, oType%, oHasProps%, oFlag%, oSecurity%)
  63.         If (ccode% = SUCCESSFUL) Then
  64.             'take all characters of server name up to terminating null
  65.             out$ = Left$(oName$, InStr(oName$, Chr$(0)) - 1)
  66.             
  67.             PrintServerList.AddItem out$
  68.         End If
  69.     Loop Until ccode%
  70.     If (PrintServerList.ListCount > 0) Then PrintServerList.ListIndex = 0
  71. End Sub
  72.  
  73. Sub OKButton_Click ()
  74.     PrintServerName$ = PrintServerList.List(PrintServerList.ListIndex)
  75.  
  76.     If (Len(PrintServerName$) > 0) Then
  77.         PSInfoForm.Show
  78.     Else
  79.         MsgBox "No print servers available.", MB_OK, "Error"
  80.         Unload PrintServerForm
  81.     End If
  82. End Sub
  83.  
  84. Sub PrintServerList_Click ()
  85.     PrintServerName$ = PrintServerList.List(PrintServerList.ListIndex)
  86. End Sub
  87.  
  88. Sub PrintServerList_DblClick ()
  89.     OKButton_Click
  90. End Sub
  91.  
  92.